package view.component.weapon.gun_lance
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.weapon.GunLanceGunVo;
	
	import view.component.BaseSCListView;
	import view.render.weapon.GunLanceGunItem;
	
	
	/**
	 * 铳枪-炮击性能界面
	 * @author £iang
	 * 
	 */	
	public class GunLanceGunView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 装填数标题 */
		public var loadNumTitle:Label;
		/** 射程标题 */
		public var distanceTitle:Label;
		/** 射角标题 */
		public var rangeTitle:Label;
		/** 单发Lv1标题 */
		public var singePower1Title:Label;
		/** 单发Lv2标题 */
		public var singePower2Title:Label;
		/** 单发Lv3标题 */
		public var singePower3Title:Label;
		/** 单发Lv4标题 */
		public var singePower4Title:Label;
		/** 单发Lv5标题 */
		public var singePower5Title:Label;
		/** 单发耗斩标题 */
		public var singleExpendTitle:Label;
		/** 蓄力炮倍率标题 */
		public var singleChargeTitle:Label;
		/** 全弹倍率标题 */
		public var fullBusterTitle:Label;
		/** 龙击炮Lv1标题 */
		public var cannonPower1Title:Label;
		/** 龙击炮Lv2标题 */
		public var cannonPower2Title:Label;
		/** 龙击炮Lv3标题 */
		public var cannonPower3Title:Label;
		/** 龙击炮Lv4标题 */
		public var cannonPower4Title:Label;
		/** 龙击炮Lv5标题 */
		public var cannonPower5Title:Label;
		/** 龙击炮耗斩标题 */
		public var cannonExpendTitle:Label;
		/** 龙击炮倍率标题 */
		public var cannonRatioTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.GREAT_SWORD_MOTION_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H * 2 + 
					UISize.LIST_TITLE_H) * this.dpiScale;
			_scrollerMaxPage = 8;
			_firstName = "动作名";
			super.initialize();
		}
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			loadNumTitle = new Label();
			loadNumTitle.text = "装填数";
			scollerContainer.addChild( loadNumTitle );
			
			distanceTitle = new Label();
			distanceTitle.text = "射程";
			scollerContainer.addChild( distanceTitle );
			
			rangeTitle = new Label();
			rangeTitle.text = "射角";
			scollerContainer.addChild( rangeTitle );
			
			singePower1Title = new Label();
			singePower1Title.text = "单发Lv1";
			scollerContainer.addChild( singePower1Title );
			
			singePower2Title = new Label();
			singePower2Title.text = "单发Lv2";
			scollerContainer.addChild( singePower2Title );
			
			singePower3Title = new Label();
			singePower3Title.text = "单发Lv3";
			scollerContainer.addChild( singePower3Title );
			
			singePower4Title = new Label();
			singePower4Title.text = "单发Lv4";
			scollerContainer.addChild( singePower4Title );
			
			singePower5Title = new Label();
			singePower5Title.text = "单发Lv5";
			scollerContainer.addChild( singePower5Title );
			
			singleExpendTitle = new Label();
			singleExpendTitle.text = "单发耗斩";
			scollerContainer.addChild( singleExpendTitle );
			
			singleChargeTitle = new Label();
			singleChargeTitle.text = "蓄力炮倍率";
			scollerContainer.addChild( singleChargeTitle );
			
			fullBusterTitle = new Label();
			fullBusterTitle.text = "全弹倍率";
			scollerContainer.addChild( fullBusterTitle );
			
			cannonPower1Title = new Label();
			cannonPower1Title.text = "击龙炮lv1";
			scollerContainer.addChild( cannonPower1Title );
			
			cannonPower2Title = new Label();
			cannonPower2Title.text = "击龙炮lv2";
			scollerContainer.addChild( cannonPower2Title );
			
			cannonPower3Title = new Label();
			cannonPower3Title.text = "击龙炮lv3";
			scollerContainer.addChild( cannonPower3Title );
			
			cannonPower4Title = new Label();
			cannonPower4Title.text = "击龙炮lv4";
			scollerContainer.addChild( cannonPower4Title );
			
			cannonPower5Title = new Label();
			cannonPower5Title.text = "击龙炮lv5";
			scollerContainer.addChild( cannonPower5Title );
			
			cannonExpendTitle = new Label();
			cannonExpendTitle.text = "击龙炮耗斩";
			scollerContainer.addChild( cannonExpendTitle );
			
			cannonRatioTitle = new Label();
			cannonRatioTitle.text = "击龙炮倍率";
			scollerContainer.addChild( cannonRatioTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstLabelFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstLabelFullW = UISize.MAIN_W * 0.3;
			firstTitle.width = firstLabelFullW - leftPadding;
			
			scollerContainer.x = firstLabelFullW;
			scollerContainer.width = UISize.MAIN_W - firstLabelFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			loadNumTitle.y = labelY;
			loadNumTitle.x = 0;
			loadNumTitle.width  = UISize.MAIN_W * 0.3;
			
			distanceTitle.y = labelY;
			distanceTitle.x = UISize.MAIN_W * 0.3;
			distanceTitle.width  = UISize.MAIN_W * 0.2;
			
			rangeTitle.y = labelY;
			rangeTitle.x = UISize.MAIN_W * 0.5;
			rangeTitle.width  = UISize.MAIN_W * 0.2;
			
			singePower1Title.y = labelY;
			singePower1Title.x = UISize.MAIN_W * 0.7;
			singePower1Title.width  = UISize.MAIN_W * 0.35;
			
			singePower2Title.y = labelY;
			singePower2Title.x = UISize.MAIN_W * 1.05;
			singePower2Title.width  = UISize.MAIN_W * 0.35;
			
			singePower3Title.y = labelY;
			singePower3Title.x = UISize.MAIN_W * 1.4;
			singePower3Title.width  = UISize.MAIN_W * 0.35;
			
			singePower4Title.y = labelY;
			singePower4Title.x = UISize.MAIN_W * 1.75;
			singePower4Title.width  = UISize.MAIN_W * 0.35;
			
			singePower5Title.y = labelY;
			singePower5Title.x = UISize.MAIN_W * 2.1;
			singePower5Title.width  = UISize.MAIN_W * 0.35;
			
			singleExpendTitle.y = labelY;
			singleExpendTitle.x = UISize.MAIN_W * 2.45;
			singleExpendTitle.width  = UISize.MAIN_W * 0.35;
			
			singleChargeTitle.y = labelY;
			singleChargeTitle.x = UISize.MAIN_W * 2.8;
			singleChargeTitle.width  = UISize.MAIN_W * 0.35;
			
			fullBusterTitle.y = labelY;
			fullBusterTitle.x = UISize.MAIN_W * 3.15;
			fullBusterTitle.width  = UISize.MAIN_W * 0.35;
			
			cannonPower1Title.y = labelY;
			cannonPower1Title.x = UISize.MAIN_W * 3.5;
			cannonPower1Title.width  = UISize.MAIN_W * 0.35;
			
			cannonPower2Title.y = labelY;
			cannonPower2Title.x = UISize.MAIN_W * 3.85;
			cannonPower2Title.width  = UISize.MAIN_W * 0.35;
			
			cannonPower3Title.y = labelY;
			cannonPower3Title.x = UISize.MAIN_W * 4.2;
			cannonPower3Title.width  = UISize.MAIN_W * 0.35;
			
			cannonPower4Title.y = labelY;
			cannonPower4Title.x = UISize.MAIN_W * 4.55;
			cannonPower4Title.width  = UISize.MAIN_W * 0.35;
			
			cannonPower5Title.y = labelY;
			cannonPower5Title.x = UISize.MAIN_W * 4.9;
			cannonPower5Title.width  = UISize.MAIN_W * 0.35;
			
			cannonExpendTitle.y = labelY;
			cannonExpendTitle.x = UISize.MAIN_W * 5.25;
			cannonExpendTitle.width  = UISize.MAIN_W * 0.35;
			
			cannonRatioTitle.y = labelY;
			cannonRatioTitle.x = UISize.MAIN_W * 5.6;
			cannonRatioTitle.width  = UISize.MAIN_W * 0.35;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstLabelFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<GunLanceGunVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:GunLanceGunItem = new GunLanceGunItem();
				var tmpData:GunLanceGunVo = dataVec[ i ] as GunLanceGunVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构滚动条容器中的标签 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"loadNum", "distance",
				"range", "singePower1",
				"singePower2", "singePower3",
				"singePower4", "singePower5",
				"singleExpend", "singleCharge",
				"fullBuster", "cannonPower1",
				"cannonPower2", "cannonPower3",
				"cannonPower4", "cannonPower5",
				"cannonExpend", "cannonRatio"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function GunLanceGunView()
		{
			super();
		}
	}
}